package com.wecan.api.saasdata;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wecan.base.PO.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


/**
 * @Author liuzhihao
 * @Date 2022.01.11
 * @Version 1.0.0
 * @Description 用户数据层服务接口
 */
@FeignClient(name = "saasdata", path = "/user")
public interface UserData {


    @PostMapping(value = "/insert")
    User insert(@RequestBody User user);

    @PostMapping(value = "/updatebyid")
    Integer updateById(@RequestBody User user);

    @PostMapping(value = "/loaduserroles")
    List<Integer> loadUserRoles(@RequestParam("userId") Long userId);

    @PostMapping(value = "/selectbyid")
    User selectById(@RequestParam("id") String id);

    @PostMapping(value = "/queryuserbyphone")
    User queryUserByPhone(@RequestParam("phone") String phone);

    @PostMapping(value = "/selectpage")
    Page<User> selectPage(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestBody User user);

    @PostMapping(value = "/updateinfobyid")
    boolean updateInfoById(@RequestBody User user);

    @PostMapping(value = "/queryuserbyid")
    User queryUserById(@RequestParam("id") Long id);

    @PostMapping(value = "/editpasswordbyphone")
    boolean editPasswordbyPhone(@RequestParam("phone") String phone, @RequestParam("password") String password);

    @PostMapping(value = "/queryuserbynameandpass")
    User queryUserByNameAndPass(@RequestParam("userName") String userName, @RequestParam("password") String password);

    @PostMapping(value = "/querynormaluserbyphone")
    User queryNormalUserByPhone(@RequestParam("phone") String phone);

    @PostMapping(value = "/queryuser")
    User queryUser(@RequestBody User user);

    @PostMapping(value = "/hasuser")
    boolean hasUser(@RequestParam("id") Long id);

    @PostMapping(value = "/updatepass")
    boolean updatePassword(@RequestParam("id") Long id, @RequestParam("password") String password);

    @PostMapping(value = "/querypass")
    String queryPassword(@RequestParam("userId") Long userId);
}
